//package com.mercury.console.config;
//
//import io.swagger.annotations.ApiOperation;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.boot.web.context.WebServerInitializedEvent;
//import org.springframework.context.ApplicationListener;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.context.annotation.Import;
//import org.springframework.web.bind.annotation.RestController;
//import springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration;
//import springfox.documentation.builders.ApiInfoBuilder;
//import springfox.documentation.builders.PathSelectors;
//import springfox.documentation.builders.RequestHandlerSelectors;
//import springfox.documentation.oas.annotations.EnableOpenApi;
//import springfox.documentation.service.ApiInfo;
//import springfox.documentation.spi.DocumentationType;
//import springfox.documentation.spring.web.plugins.Docket;
//
//import java.net.Inet4Address;
//import java.net.InetAddress;
//import java.net.UnknownHostException;
//
//
///**
// * @author mercury
// */
//@EnableOpenApi
//@Configuration
//@Import(BeanValidatorPluginsConfiguration.class)
//@Slf4j
//public class Knife4jConfig implements ApplicationListener<WebServerInitializedEvent> {
//
//    @Bean(value = "defaultApi3")
//    public Docket defaultApi3() {
//        return new Docket(DocumentationType.OAS_30)
//                .apiInfo(apiInfo())
//                //分组名称
//                .groupName("mercury-分组")
//                .select()
//                //加了ApiOperation注解的类，才生成接口文档
//                .apis(RequestHandlerSelectors.withClassAnnotation(RestController.class))
//                .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
//                .paths(PathSelectors.any())
//                .build();
//    }
//
//    private ApiInfo apiInfo() {
//        return new ApiInfoBuilder()
//                .title("mercury swagger-bootstrap-ui！！！")
//                .description("swagger-bootstrap-ui REST ful APIs")
//                .version("1.0")
//                .build();
//    }
//
//
//    @Override
//    public void onApplicationEvent(WebServerInitializedEvent event) {
//        try {
//            InetAddress inetAddress = Inet4Address.getLocalHost();
//            int serverPort = event.getWebServer().getPort();
//            log.info("项目启动成功接口文档地址是: http://" + inetAddress.getHostAddress() + ":" + serverPort + "/doc.html");
//        } catch (UnknownHostException var3) {
//            log.error(var3.getMessage(), var3);
//        }
//
//    }
//
//}
